Speed up `sort` by special-casing the `value<` ordering
authorMattias Engdegård <mattiase@acm.org>
Thu, 21 Mar 2024 18:35:15 +0000 (19:35 +0100)
committerMattias Engdegård <mattiase@acm.org>
Fri, 29 Mar 2024 10:39:38 +0000 (11:39 +0100)
commitdeae311281522864ebabaf56adafbe37032cc8a9
tree9672a97c14084162887cd6cc54d3565c195ce9e3
parentae5f2c02bd2fc269e2cc32c8039d95fbf4225e69
Speed up `sort` by special-casing the `value<` ordering

This gives a 1.5x-2x speed-up when using the default :lessp value,
by eliminating the Ffuncall overhead.

* src/sort.c (order_pred_lisp, order_pred_valuelt): New.
(merge_state, inorder, binarysort, count_run, gallop_left, gallop_right)
(merge_init, merge_lo, merge_hi, tim_sort):
* src/fns.c (Fsort):
When using value<, call it directly.
src/fns.c
src/sort.c